﻿namespace HelpersDotNet
{
    public partial class Helpers
    {
        public partial class WPF
        {
            /// <summary>
            /// Possible list of Rendering Tier supported for WPF
            /// </summary>
            public enum RenderingTier
            {
                /// <summary>
                /// The video card will not provide any hardware acceleration.
                /// This corresponds to DirectX version level of less than 7.0
                /// </summary>
                RenderingTier0 = 0,
                /// <summary>
                /// The video card can provide partial hardware accleration.
                /// This corresponds to a DirectX version level greater than 7.0
                /// but less than 9.0
                /// </summary>
                RenderingTier1 = 1,
                /// <summary>
                /// All features that can be hardware accelerated will be.
                /// This corresponds to a DirectX version greater than or equal
                /// to 9.0
                /// </summary>
                RenderingTier2 = 2,
                /// <summary>
                /// Support for future where other tiers may be used.
                /// </summary>
                RenderingTierUndefined
            }

            public static class RenderCapability
            {
                public static RenderingTier RenderingTier
                {
                    get
                    {
                        int renderingTier = (System.Windows.Media.RenderCapability.Tier >> 16);
                        
                        switch (renderingTier)
                        {
                            case 0:
                                return RenderingTier.RenderingTier0;
                            case 1:
                                return RenderingTier.RenderingTier1;
                            case 2:
                                return RenderingTier.RenderingTier2;
                            default:
                                return RenderingTier.RenderingTierUndefined;
                        }
                    }
                }
            }
        }
    }
}